import {request} from 'umi'
import {Iadduser,Iputuser,Iaddidentity,Iapi,IsetIdentityApi,Iviewlist,IAddAuthorityView} from '@/interface/usermanage'
export const add_user=(data:Iadduser)=>{     //添加用户
      return request('/user',{method:"post",data})
}


export const get_identitylist=()=>{    //获取身份的信息
      return request("/user/identity",{method:"get"})
}

export const get_user=()=>{    //获取用户的信息列表
       return request("/user/user",{method:"get"})
}

export const Put_user=(data:Iputuser)=>{  //更新用户
        return request("/user/user",{method:"put",data})
}

export const add_identitylist=(paramsd:Iaddidentity)=>{  //添加身份
       return request("/user/identity/edit",{method:"get",params:paramsd})
}

export const add_api=(paramsd:Iapi)=>{   //添加api权限  为以后用户请求接口的权限
      return request("/user/authorityApi/edit",{method:"get",params:paramsd})
}

export const get_apilist=()=>{    //获取api的数据
       return request ('/user/api_authority',{method:"get"})
}

export const set_IdentityApi=(data:IsetIdentityApi)=>{  //给身份设置api接口权限
      return request("/user/setIdentityApi",{method:"post",data})
}

export const get_viewlist=()=>{    //获取视图权限数据
       return request("/user/view_authority",{method:"get"})
}

export const set_IdentityView=(data:Iviewlist)=>{  //给身份是指视图权限
      return request("/user/setIdentityView",{method:"post",data})
}

export const get_apiidentity=()=>{   //身份和api接口关系
      return request('/user/identity_api_authority_relation',{method:'get'})
}

export const get_viewidentity=()=>{   //身份和视图关系
      return request('/user/identity_view_authority_relation',{method:'get'})
}

export const set_authorityView=(params:IAddAuthorityView)=>{   //设置视图权限
      return request("/user/authorityView/edit",{method:'get',params})
}